package cn.hospital.seviceimpl;

import cn.hospital.dao.GrouptableMapper;
import cn.hospital.dao.PatientInformationSheetMapper;
import cn.hospital.entity.Chart;
import cn.hospital.entity.Grouptable;
import cn.hospital.service.ChartService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ChartServiceImpl implements ChartService {

    @Resource
    private PatientInformationSheetMapper patientInformationSheetMapper;
    @Resource
    private GrouptableMapper grouptableMapper;

    /**
     * 根据时间查询（一年中能够每一个月患者数量比对）
     * @param timeMonth
     * @return
     */
    public List<Chart> findByTime(String timeMonth){
        return patientInformationSheetMapper.selectByTime(timeMonth);
    }

    /**
     * 根据时间查询（一年中能够每一个月随访组数量比对）
     * @param timeMonth
     * @return
     */
    public List<Chart> findByCreatorTime(String timeMonth){
        List<Chart> chartList = grouptableMapper.selectByCreatorTime(timeMonth);
        for (Chart ch:chartList){
            ch.setName( ch.getName()+"月" );
        }
        return chartList;
    }
}
